home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tcl / demos / mkEntry.tcl < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.5 KB  |  30 lines

  1. # mkEntry w
  2. #
  3. # Create a top-level window that displays a bunch of entries.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkEntry {{w .e1}} {
  9.     catch {destroy $w}
  10.     toplevel $w
  11.     dpos $w
  12.     wm title $w "Entry Demonstration"
  13.     wm iconname $w "Entries"
  14.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 200 \
  15.         -text "Three different entries are displayed below.  You can add characters by pointing, clicking and typing.  You can delete by selecting and typing Control-d.  Backspace, Control-h, and Delete may be typed to erase the character just before the insertion point, Control-W erases the word just before the insertion point, and Control-u clears the entry.  For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button 2 pressed.  Click the \"OK\" button when you've seen enough."
  16.     frame $w.frame -borderwidth 10
  17.     pack append $w.frame \
  18.     [entry $w.frame.e1 -relief sunken] {top pady 10 fillx} \
  19.     [entry $w.frame.e2 -relief sunken] {top pady 10 fillx} \
  20.     [entry $w.frame.e3 -relief sunken] {top pady 10 fillx}
  21.     $w.frame.e1 insert 0 "Initial value"
  22.     $w.frame.e2 insert end "This entry contains a long value, much too long "
  23.     $w.frame.e2 insert end "to fit in the window at one time, so long in fact "
  24.     $w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
  25.     button $w.ok -text OK -command "destroy $w"
  26.  
  27.     pack append $w $w.msg {top fill} $w.frame {top expand fill} \
  28.     $w.ok {bottom fill}
  29. }
  30.